package com.dfbz.demo01;

import java.util.Scanner;

/**
 * @author lscl
 * @version 1.0
 * @intro:
 */
public class Demo06_Scanner小练习_02_求偶数 {
    public static void main(String[] args) {
        // 创建一个扫描器
        Scanner scanner = new Scanner(System.in);

        System.out.println("请输入一个数: ");
        int num = scanner.nextInt();

        int count = 0;

        for (int i = 0; i <= num; i+=2) {
            count++;
        }

        /*for (int i = 0; i <= num; i++) {
            if (i % 2 == 0) {
                count++;
            }
        }*/

        System.out.println("0~" + num + "之间的偶数个数为【" + count + "】");

    }
}
